<?php
include_once("./fileSystem.php");
include_once("./connectDatabase.php");
//$file_name = "test.txt"; //测试用
$file_name = $_GET["attachment"];
delete("../Public/Uploads/", "$file_name");
echo $file_name;
get_connection();
$sql = "UPDATE news SET news_attachment='' WHERE news_attachment='$file_name'";
if (mysqli_query($conn, $sql)) {
    //echo "<script>alert('删除成功！');window.location.href='./adminShow.php'</script>";
} else {
    $error = mysqli_error($conn);
    $error = str_replace('\'', '', $error);
    //echo "<script>alert('删除失败！$error');</script>";
}
close_connection();
?>